package com.yang.net.host;

import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.Mapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author yds
 * @program net-sokect_stduy
 * @description 作为一个请求host文件修改
 * @create 2020-09-25 16:23
 **/
@Controller
@RequestMapping("/1")
public class HostModify {
    @RequestMapping("/2")
    public void alipayforward(HttpServletRequest req, HttpServletResponse resp) throws Exception {
          String header=req.getHeader("host");
          resp.sendRedirect("http://baidu.com/");
    }
}